package com.net.wanjian.networkhospitalmanager.activity;

import android.os.Bundle;
import android.provider.BlockedNumberContract;
import android.util.Log;
import android.view.View;
import android.view.WindowManager;

import com.net.wanjian.networkhospitalmanager.R;
import com.net.wanjian.networkhospitalmanager.activity.base.BaseActivity;
import com.net.wanjian.networkhospitalmanager.net.HttpUtil;
import com.net.wanjian.networkhospitalmanager.netstatus.NetUtils;
import com.net.wanjian.networkhospitalmanager.utils.PicassoUtil;
import com.net.wanjian.networkhospitalmanager.utils.SharedXmlUtil;

import butterknife.BindView;
import butterknife.ButterKnife;
import uk.co.senab.photoview.PhotoView;
import uk.co.senab.photoview.PhotoViewAttacher;

public class PhotoViewActivity extends BaseActivity {


    @BindView(R.id.photo_view_imageview)
    PhotoView photoViewImageview;
    private PhotoViewAttacher mPhotoViewAttacher;

    @Override
    protected void initData() {
        WindowManager wm = this.getWindowManager();
        final int width = wm.getDefaultDisplay().getWidth();
        final int height = wm.getDefaultDisplay().getHeight();

        mPhotoViewAttacher = new PhotoViewAttacher(photoViewImageview);
        mPhotoViewAttacher.setZoomable(false);
        mPhotoViewAttacher.setOnPhotoTapListener(new PhotoViewAttacher.OnPhotoTapListener() {
            @Override
            public void onPhotoTap(View view, float x, float y) {
                finish();
            }
        });

        Bundle bundle = getIntent().getExtras();
        if (null != bundle){
            String imageUrl = bundle.getString("ImageBig");
            Log.e(TAG, "initData: "+imageUrl);
            PicassoUtil.loadImage(this, HttpUtil.getOperationDevicePhoto(imageUrl, SharedXmlUtil.getInstance().getHospitalId()),
                    R.mipmap.logo,photoViewImageview);
        }


    }

    @Override
    protected int setStatusColor() {
        return getResources().getColor(R.color.color_text_black);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_photo_view;
    }

    @Override
    protected void onNetworkConnected(NetUtils.NetType type) {

    }

    @Override
    protected void onNetworkDisConnected() {

    }

}
